//
//  ProgressViewOfProDD.m
//  UEAssistant
//
//  Created by mac on 2017/3/1.
//  Copyright © 2017年 youyixinxi. All rights reserved.
//

#import "ProgressViewOfProDD.h"
#import "RCProgressView.h"

@interface ProgressViewOfProDD (){

    CGFloat        _progress;
    UIColor        *_progressBarcolor;
}

@property (nonatomic, strong) UILabel                 *progressLabel;
@property (nonatomic, strong) RCProgressView          *progressViewR;
@property (nonatomic, strong) UILabel                 *progressDataLabel;

@end

@implementation ProgressViewOfProDD

- (instancetype)initWithFrame:(CGRect)frame progress:(CGFloat)progress barColor:(UIColor *)barColor{

    self = [super initWithFrame:frame];
    if (self) {
        _progress = progress;
        _progressBarcolor = barColor;
        [self setUI];
    }
    return self;
}

+ (id)initWithFrame:(CGRect)frame progress:(CGFloat)progress barColor:(UIColor *)barColor{

    ProgressViewOfProDD *view = [[ProgressViewOfProDD alloc]initWithFrame:frame progress:progress barColor:barColor];
    return view;
    
}

- (void)setUI{

    _progressLabel = [[UILabel alloc]initWithFrame:CGRectMake(7, 0, 45, 20)];
    _progressLabel.backgroundColor = [UIColor clearColor];
    _progressLabel.font = [UIFont systemFontOfSize:14];
    _progressLabel.textColor = [UIColor grayColor];
    _progressLabel.text = @"总进度";
    _progressLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_progressLabel];
    
    _progressViewR = [[RCProgressView alloc]initWithFrame:CGRectMake(_progressLabel.frame.origin.x+_progressLabel.frame.size.width-5,
                                                                                      _progressLabel.frame.origin.y+50,
                                                                                      Screen_Width - 40 - 50*2,
                                                                                      8)];
    _progressViewR.center = CGPointMake(self.center.x, _progressLabel.center.y);
    [_progressViewR setProgress:_progress];
    [_progressViewR setProgressBarColor:_progressBarcolor];
    [self addSubview:_progressViewR];
    
    _progressDataLabel = [[UILabel alloc]initWithFrame:CGRectMake(_progressViewR.frame.origin.x+_progressViewR.frame.size.width+15,_progressLabel.frame.origin.y+5, 50, 10)];
    _progressDataLabel.backgroundColor = [UIColor clearColor];
    _progressDataLabel.font = [UIFont systemFontOfSize:13];
    _progressDataLabel.textColor = [UIColor grayColor];
    _progressDataLabel.text = @"100%";
    _progressDataLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_progressDataLabel];

}

@end
